package com.bamatea.reportfrom.controller;

import com.bamatea.reportfrom.domain.BdInvclWc;
import com.bamatea.reportfrom.domain.BdInvclWcC;
import com.bamatea.reportfrom.domain.IcGeneralAllWc;
import com.bamatea.reportfrom.domain.PoOrderBWc;
import com.bamatea.reportfrom.service.BdInvclWccService;
import com.bamatea.reportfrom.service.BdinvclWcSercive;
import com.bamatea.reportfrom.service.IcgeneralAllWcService;
import com.bamatea.reportfrom.service.poOrderBwcService;
import com.bamatea.reportfrom.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Auther: libingbing
 * @Date: 2020-04-24 10 :31
 * @Description:
 */
@RestController
@RequestMapping("/lbb")
public class testController {
    @Autowired
    private BdinvclWcSercive sercive;
    @Autowired
    private IcgeneralAllWcService icgeneralAllWcService;
    @Autowired
    private com.bamatea.reportfrom.service.poOrderBwcService poOrderBwcService;
    @Autowired
    public BdInvclWccService bdInvclWccService;
    @PostMapping("/test")
    public Object findOne(@RequestParam("invclasscode") String invclasscode){
        BdInvclWc item = sercive.findById(invclasscode);
        return ResponseUtil.ok(item);
    }

    @PostMapping("/test2")
    public Object findten(){
        List<BdInvclWc> findten = sercive.findAllCategory();
        List list =new ArrayList();
        for(BdInvclWc item:findten){
            list.add(item.getOrdinarytype());
        }
        return ResponseUtil.okList(list);
    }
    @PostMapping("/test3")
    public  Object testwc(){
        List<IcGeneralAllWc> one = icgeneralAllWcService.findOne();
        return ResponseUtil.okList(one);
    }
    @PostMapping("/test4")
    public Object testwcc(){
        List<BdInvclWc> category = sercive.findCategory();

        return ResponseUtil.okList(category);
    }
    @PostMapping("/test5")
    public Object testwcc5(){
        List<PoOrderBWc> all = poOrderBwcService.findAll();

        return ResponseUtil.okList(all);
    }
    @PostMapping("/test6")
    public Object testwcc6(){
        List<BdInvclWcC> allCategory = bdInvclWccService.findAllCategory();
        return ResponseUtil.okList(allCategory);
    }
}
